package com.smart.platform.web;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Map;

/**
 * Created by 隔壁老王 on 2018/6/19.
 */
@Controller
public class MainController {
    @RequestMapping("/")
    public String root() {
        return "redirect:/index";
    }

    @RequestMapping("/index")
    public String index() {
        return "index";
    }
//    @RequestMapping("/toControl")
//    public String toControl() {
//        return "control_platform";
//    }
    @RequestMapping("/user/index")
    public String userIndex() {
        return "/user/index";
    }
    @RequestMapping("/login")
    public String login() {
        return "signin";
    }
    @RequestMapping("/login-error")
    public String loginError(Map<String,Object> map) {
        map.put("loginError",true);
        return "signin";
    }
    @GetMapping("/401")
    public String accesssDenied() {
        return "401";
    }
    @GetMapping("/test")
    public String test() {
        return "test";
    }
    @RequestMapping("/toControl")
    public String toControl(String onLoadUrl, Map<String,Object>map) {
        System.out.println("onLoadUrl="+onLoadUrl);
        map.put("onLoadUrl",onLoadUrl);
        return "control_platform";
    }
}
